package admin.controllers;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import models.DomainModel;

import admin.data.DomainData;

public class UpdateBlacklistDomainServlet extends HttpServlet {
	public void doGet(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException {
		String action = (String) request.getParameter("action");
		String strIds = (String) request.getParameter("ids");
		
		DomainData domainData = new DomainData();
		DomainModel domain = new DomainModel();
		
		String[] ids = strIds.split(",");
		for (int i = 0; i < ids.length; i++) {
	        if (!ids[i].isEmpty()) {
	        	domain = domainData.get(ids[i]);
	        	if (domain != null) {
	        		domain.setStatus(1);
	        		domainData.insert(domain);
	        	}
	    	}
	    }
	}
}
